/**
 * 
 */
package com.mtolstykh.data;

import java.util.Iterator;
import java.util.Set;

/**
 * @author unlocked
 *
 */
public class Customer {
	private String 		Title;
	private Set<Person> contacts;
	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		Title = title;
	}
	/**
	 * @return the title
	 */
	public String getTitle() {
		return Title;
	}
	/**
	 * @param contacts the contacts to set
	 */
	public void setContacts(Set<Person> contacts) {
		this.contacts = contacts;
	}
	/**
	 * @return the contacts
	 */
	public Set<Person> getContacts() {
		return contacts;
	}
	
	public void addContact(Person p){
		if(!contacts.contains(p))
			contacts.add(p);
	}
	
	public void removeContact(String pid){
		Iterator<Person> it = contacts.iterator();
		while(it.hasNext()){
			Person p2del = it.next();
			if(p2del.getId() == pid)
				contacts.remove(p2del);
		}
	}
}
